From bc2915b7220e4cd7a511213ca54b67743361e684 Mon Sep 17 00:00:00 2001 From: Liangent Date: Sat, 1 Jun 2013 15:52:26 +0000 Subject: [PATCH] Attempt to remove a hard-coded "wikipedia". Change-Id: I3c1567929eaa11a6ca0f3e8d7fe73653375b595b --- includes/SiteConfiguration.php | 4 ++-- tests/phpunit/includes/SiteConfigurationTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/SiteConfiguration.php b/includes/SiteConfiguration.php index 82344289e5..fa871fe0b3 100644 --- a/includes/SiteConfiguration.php +++ b/includes/SiteConfiguration.php @@ -477,13 +477,13 @@ class SiteConfiguration { $site = null; $lang = null; - foreach ( $this->suffixes as $suffix ) { + foreach ( $this->suffixes as $altSite => $suffix ) { if ( $suffix === '' ) { $site = ''; $lang = $db; break; } elseif ( substr( $db, -strlen( $suffix ) ) == $suffix ) { - $site = $suffix == 'wiki' ? 'wikipedia' : $suffix; + $site = is_numeric( $altSite ) ? $suffix : $altSite; $lang = substr( $db, 0, strlen( $db ) - strlen( $suffix ) ); break; } diff --git a/tests/phpunit/includes/SiteConfigurationTest.php b/tests/phpunit/includes/SiteConfigurationTest.php index 4cdf0201be..181a9132e6 100644 --- a/tests/phpunit/includes/SiteConfigurationTest.php +++ b/tests/phpunit/includes/SiteConfigurationTest.php @@ -31,7 +31,7 @@ class SiteConfigurationTest extends MediaWikiTestCase { $this->mConf = new SiteConfiguration; - $this->mConf->suffixes = array( 'wiki' ); + $this->mConf->suffixes = array( 'wikipedia' => 'wiki' ); $this->mConf->wikis = array( 'enwiki', 'dewiki', 'frwiki' ); $this->mConf->settings = array( 'simple' => array( -- 2.20.1